<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="http://localhost/project/shop/Static/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="http://localhost/project/shop/Static/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="http://localhost/project/shop/Static/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="http://localhost/project/shop/Static/Admin/Flat/img/favicon.ico">
	    <script type="text/javascript" src="http://localhost/project/shop/Static/Admin/Js/jquery-1.7.2.min.js"></script>
	    <!--上传插件uploadify的文件--> 
        <script type="text/javascript" src="http://localhost/project/shop/Static/uploadify/jquery.uploadify.min.js"></script>
        <link href="http://localhost/project/shop/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>

        <script type="text/javascript">
            //让上传按钮显示
            function uploadifyShow(){
                     $('#file').uploadify({
                    'formData'     : {//POST数据
                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
                    },
                    'fileTypeDesc' : '上传文件',//上传描述
                    'fileTypeExts' : '*.jpg;*.png',
                    'swf'      : 'http://localhost/project/shop/Static/uploadify/uploadify.swf',
                    'uploader' : '<?php echo U("upload");?>',
                    'buttonText':'选择文件',
                    'fileSizeLimit' : '2000KB',
                    'uploadLimit' : 1,//上传文件数
                    'width':65,
                    'height':25,
                    'multi': false,//是否多文件上传
                    'successTimeout':10,//等待服务器响应时间
                    'removeTimeout' : 0.2,//成功显示时间
                    'onUploadSuccess' : function(file, data, response) {
                        //把变量转为json
                        data=$.parseJSON(data);
                        var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+data.url+"' style='width:90px;' class='img-thumbnail'/><a href='javascript:;' class='del-img'>X</a><input type='hidden' name='logo' value='"+data.path+"' /></li>";
                        $("#uploadList ul").prepend(li);
                        //让删除按钮消失
                        $('.uplodify-box').html('');
                    }
                });
            }
            $(function(){
                    //刷新页面让上传插件显示
                    uploadifyShow();
                    //点击x，隐藏图片，并且上传按钮显示
                $('.del-img').live('click',function(){
                    //获得当前图片的所在的li，让其消失
                    $(this).parent('li').hide();
                    //上传按钮显示
                    $('.uplodify-box').html('<input id="file" type="file" multiple="false"><span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>');
                    uploadifyShow();
                    
                })
            });
        </script>


        <style type="text/css">
        #uploadList{
            width: 600px; 
        }
        #uploadList li{
            width: 90px; 
            margin-right: 10px;
            list-style: none;
            position: relative;
        } 
        #uploadList li img{
            width: 90px;  
        }  
        #uploadList li a{
            display: block;
            position: absolute;
            top:0px;
            right:0px; 
            width: 20px;
            height: 20px; 
            color: #f90;
        }  

        </style>

	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="dist/js/vendor/html5shiv.js"></script>
	      <script src="dist/js/vendor/respond.min.js"></script>
	    <![endif]-->
	</head>
	<body>
		<div class="alert alert-success">添加商品品牌</div>
		<form action="" method="post">
		<div class="form-group">
			<label for="exampleInputEmail1">品牌名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入品牌名称" name="bname">
		</div>
		
		<div class="form-group">
			<label for="exampleInputEmail1">品牌LOGO</label>
			<!-- <input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入品牌LOGO" name="logo"> -->

			<div class='imgface_box'> 
					<!-- <img src="<?php echo $userInfo['logo'];?>" alt="" style="width:90px;" id="preview"/>  -->
            <div lab="uploadFile">
                <!--这个div是放上传按钮的-->
                <div class="uplodify-box">
                    <!--如果没有上传图片，显示上传按钮-->
                        <?php if(!$userInfo['logo']){ ?>
                        <input id="file" type="file" multiple="false">
                            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
                    <?php } ?>
                </div>
                <div id="uploadList">
                    <ul>
                            <!--如果有图片上传，则显示图片-->
                                <?php if($userInfo['logo']){ ?>
                                <li>
                                    <img src="http://localhost/project/shop/<?php echo $userInfo['logo'];?>" style="width:90px;"/>
                                    <a href="javascript:;" class="del-img" path="<?php echo $userInfo['logo'];?>">X</a>
                                </li>
                            <?php } ?>
                            
                    </ul>
                </div>
            </div> 

			</div> 



		</div>
		 
		<div class="form-group">
			<label for="exampleInputEmail1">是否热门</label>
			<br />
			<label class="radio radio-inline" for="radio5">
				<input id="radio5" class="custom-radio" type="radio" data-toggle="radio" value="1" checked="" name="is_hot">
				<span class="icons">
				<span class="icon-unchecked"> </span>
				<span class="icon-checked"> </span>
				</span>
				是
			</label>
			<label class="radio  radio-inline" for="radio6">
				<input id="radio6" class="custom-radio" type="radio" data-toggle="radio" value="0" name="is_hot">
				<span class="icons">
				<span class="icon-unchecked"> </span>
				<span class="icon-checked"> </span>
				</span>
				否
			</label>
		</div>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>
</html>
